/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entityBean;

import entity.Courses;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author ADMIN
 */
@Stateless
public class CoursesFacade extends AbstractFacade<Courses> {

    @PersistenceContext(unitName = "Cms_Portal_Source-ejbPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public CoursesFacade() {
        super(Courses.class);
    }

    public int update(String cname, int cid) {
        return em.createQuery("UPDATE Courses c SET c.cname = :cname WHERE c.cid =" + cid).
                setParameter("cname", cname).
                executeUpdate();
    }
}
